package com.example.rpapp.acceptprize.command;


import com.example.rpapp.assembler.AcceptPrizeAssembler;
import com.example.rpclient.dto.AcceptPrizeAddCmd;
import com.example.rpclient.dto.data.AcceptPrizeVo;
import com.example.rpdomain.acceptprize.AcceptPrizeEntity;
import com.example.rpdomain.gateway.AcceptPrizeGateway;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
@AllArgsConstructor
public class AcceptPrizeAddCmdExe {

    private final AcceptPrizeGateway acceptPrizeGateway;

    public AcceptPrizeVo execute(AcceptPrizeAddCmd cmd) {
        AcceptPrizeEntity entity = acceptPrizeGateway.save(AcceptPrizeAssembler.toEntity(cmd));

        return AcceptPrizeAssembler.toAcceptPrizeVO(entity);
    }
}
